import myRequest from '../../index'
import { IDataType } from '../../types'

const UploadImg = (queryInfo: any) => {
  return myRequest.post<IDataType>({
    url: 'upload/file',
    data: queryInfo,
    params: queryInfo,
    headers: {
      'Content-Type': 'multipart/form-data'
      // eslint-disable-next-line no-dupe-keys
    }
  })
}
const UploadText = (queryInfo: any) => {
  return myRequest.post<IDataType>({
    url: 'upload/text',
    data: queryInfo,
    params: queryInfo
  })
}

const ChangePassword = (queryInfo: any) => {
  return myRequest.post<IDataType>({
    url: 'alter',
    data: queryInfo,
    params: queryInfo
  })
}
const Curdlinkman = (url: string, queryInfo: any) => {
  return myRequest.get<IDataType>({
    url: url,
    data: queryInfo,
    params: queryInfo
  })
}
const ChangeCurdUser = (queryInfo: any) => {
  return myRequest.post<IDataType>({
    url: 'constant/CurdUser',
    data: queryInfo,
    params: queryInfo
  })
}
const Changerecord = (queryInfo: any) => {
  return myRequest.get<IDataType>({
    url: 'constant/record',
    data: queryInfo,
    params: queryInfo
  })
}

const Updateenws = (queryInfo: any) => {
  // console.log('xasdsadsa', queryInfo.type)
  // if (queryInfo.type == '') {
  //   queryInfo.type == 0
  // }
  return myRequest.post<IDataType>({
    url: 'upload/news',
    data: queryInfo,
    params: queryInfo
  })
}
export {
  UploadImg,
  UploadText,
  ChangePassword,
  Curdlinkman,
  ChangeCurdUser,
  Changerecord,
  Updateenws
}
